package com.maycurobj.repository.bpm;


import com.maycurobj.entity.bpm.JobNumberDTO;
import com.maycurobj.entity.bpm.ParticipantDTO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface ParticipantMapper extends JpaRepository<ParticipantDTO, String> {
    /**
     * 查找bpm中参与人是否有相似行程
     */
    @Query(nativeQuery = true, value= "select `subject`,sequenceNo,participants,new_date_start_n,new_date_n from i5zdm_saleplan_opdca where participants like :id AND (new_date_start_n <= :new_date_n AND new_date_n >= :new_date_start_n)  AND id!=:obj")
    List<ParticipantDTO> getSimilarResults(@Param(value = "id") String id, @Param(value = "new_date_start_n") String new_date_start_n, @Param(value = "new_date_n") String new_date_n, @Param(value = "obj") String obj);
    /**
     * 查找bpm中客户是否有相似行程
     */
    @Query(nativeQuery = true, value= "select id,`subject`,sequenceNo,participants,new_date_start_n,new_date_n from i5zdm_saleplan_opdca where new_account_name like :new_account_name AND (new_date_start_n <= :new_date_n AND new_date_n >= :new_date_start_n)  AND id!=:obj")
    List<ParticipantDTO> getAccountResults(@Param(value = "new_account_name") String new_account_name, @Param(value = "new_date_start_n") String new_date_start_n, @Param(value = "new_date_n") String new_date_n, @Param(value = "obj") String obj);
}
